home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 105_01.zip / TESTTRIG.C < prev    next >
Text File  |  1993-06-09  |  1KB  |  40 lines

  1.  
  2.  /* simple program to test sine, cosine and tangent functions */
  3.  
  4. main()
  5. {
  6. char *sine(),*cosine(),*degtorad(),*radtodeg();
  7. char s[80],angd[5],angr[5],angd2[5],result[5];
  8. char result2[5],*itof(),*gets();
  9. char *atof(), *fpadd(), initang[5], incrang[5], endang[5];
  10. char result3[5],result4[5],*arctan();
  11. int scanf(), fpcomp(), index;
  12.  
  13.     while (1)
  14.     {printf("\nEnter initial angle in degrees ");
  15.      gets(s);
  16.      atof(initang,s);
  17.      printf("\nEnter increment angle in degrees ");
  18.      gets(s);atof(incrang,s);
  19.      printf("\nEnter end angle in degrees ");
  20.      gets(s);atof(endang,s);
  21.       for(index=0;index<=4;index++) angd[index] = initang[index] ;
  22.      while(fpcomp(angd,endang) <= 0)
  23.        {
  24.        degtorad(angr,angd);
  25.        radtodeg(angd2,angr);
  26.        printf("\n Input %e deg, %e rad, %e reconv deg ",angd,angr,
  27.         angd2);
  28.        sine(result,angr);
  29.        printf("\n sine = %e",result);
  30.        cosine(result2,angr);
  31.        printf(" cosine = %E",result2);
  32.        tangent(result3,angr);
  33.        printf(" tangent = %e",result3);
  34.        arctan(result4,result3);
  35.        printf("\n arctangent = %e angle was %e ",result4,angr);
  36.        fpadd(angd,angd,incrang);
  37.       }
  38.     }
  39. }
  40.